<?php

namespace App\Models\Activity;

use App\Models\BaseModel;
use App\Models\Shop\ShopModel;
use App\Models\Traits\KfSoftDeletes;
use App\Models\Traits\KfUid;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasOne;

class ShopOrderActivityShopJoinRelModel extends BaseModel
{
    use HasFactory;
    use KfSoftDeletes;
    use KfUid;

    protected $table = "shop_order_activity_shop_join_rel";

    const STATUS_NOT_APPLY = 0;
    const STATUS_APPLY_IN  = 1;
    const STATUS_CANCEL    = 2;
    const STATUS_TEXT      = [
        self::STATUS_NOT_APPLY => "未参与",
        self::STATUS_APPLY_IN  => "参与",
        self::STATUS_CANCEL    => "取消参与",
    ];

    protected $fillable = [
        'shopOrderActivityId',
        'shopId',
        'status',
        'createdAt',
        'createdByUid',
        'updatedAt',
        'updatedByUid',
        'isDeleted'
    ];


    /**
     * @return HasOne
     */
    public function shopDetailRel(): HasOne
    {
        return $this->hasOne(ShopModel::class, "id", "shopId");
    }

    /**
     * @return HasOne
     */
    public function applyShopRel(): HasOne
    {
        return $this->hasOne(ShopOrderActivityShopRelModel::class, "shopOrderActivityId", "shopOrderActivityId");
    }
}
